
app:registClass("RewardController", "app.reward.controllers.RewardController")
app:registClass("BoxController", "app.reward.controllers.BoxController")

local RewardModel = import(".models.RewardModel")

app:registInst(RewardModel.new())

app:registInst(app:getClass("RewardController").new({type="systemUI"}))
app:registInst(app:getClass("BoxController").new({type="popupUI"}))

local model = app:getInst("RewardModel")
app.session:on("pb_activity.S2C_SendTrackList", function(msg)
    model:setTraceList(msg.trackIconInfos)
end)

app.session:on("pb_activity.S2C_AllActivitys", function(msg)
    model:setAllActivitys(msg.lableInfos)
end)

--充值完毕后需要监听
app.session:on("pb_activity.S2C_GetFirstChargeRewardInfo", function(msg)
    model:updateFirstRechargeInfo(msg)
end)

app.session:on("pb_activity.S2C_GetNewActivity", function(msg)
    model:changeOldActivity(msg)
end)

-- 副本宝箱推送(不依赖服务器推送，宝箱界面不会因为切换地图而关闭)
app.session:on("pb_luckbox.S2C_NewLuckBoxNotice", function(msg)
    -- dump(msg, "S2C_NewLuckBoxNotice")
    -- UD:setLuckboxId(msg.luckboxId)
end)

app.session:on("pb_recharge.S2C_GetSuperPrivilegeInfo", function(msg)
    msg.uuid = "4080"
    app:sendMsg("RewardController", "refreshCurrentPanel", msg)
end)

app.session:on("pb_activity.S2C_ActivityRedPoint", function(msg)
    if msg and msg.uuid then
        model:setRedPoint(msg.uuid, msg.isRed)
    end
end)

--新的活动 也就是运营配置的活动 以前部分可能会整合进来
--接受该协议 决定主页上是否显示运营活动按钮以及红点 FUNC_TYPE_REWARD_MONITOR_TRACE
app.session:on("pb_monitorActivity.S2C_OperateActivityInfo", function(msg)
    model:updateMonitorActivityIcon(msg)
end)